<template>
	<view class="content">
		<view class="content_list">
			<view class="name">通讯录名称</view>
			<input type="text" placeholder="如:张总的通讯录"/>
		</view>
		<view class="content_list">
			<view class="name">所属行业</view>
			<view class="text overflow1" @click="showTab = true">{{tabName!=''?tabName:'请选择'}}</view>
			<uv-icon name="arrow-right" color="#7f8289" size="22" @click="showTab = true"></uv-icon>
		</view>
		<view class="content_button">
			确认创建
		</view>
		<view class="content_box" v-if="showTab">
			<view class="bj" @click="showTab=false"></view>
			<view class="box">
				<view class="title">
					选择行业
					<view class="icon" @click="showTab=false">
						<uv-icon name="close" size="22"></uv-icon>
					</view>
				</view>
				<view class="list" v-for="(v,k) in listTab" :key="k">
					<view class="list_title">
						{{v.title}}
					</view>
					<view class="list_box">
						<view :class="['item',tabId==v1.id?'is':'']" v-for="(v1,k1) in v.list" :key="k1" @click="setTab(v1.id,v1.name)">{{v1.name}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		defineProps,
	} from 'vue'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	const listTab = ref([
		{
			title:'机械/汽车/电子/五金',
			list:[
				{name:'汽车相关',id:'1'},
				{name:'汽车相关',id:'2'},
				{name:'汽车相关',id:'3'},
				{name:'汽车相关',id:'4'},
				{name:'汽车相关',id:'5'}
			]
		}
	])
	const showTab = ref(false)
	const indexTab = ref(null)
	const tabName = ref('')
	const tabId = ref('')
	const setTab = (id,name)=>{
		showTab.value = false
		tabName.value = name
		tabId.value = id
	}
</script>

<style lang="scss" scoped>
	.content{
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		&_list{
			width: calc(100% - 60rpx);
			padding-left: 30rpx;
			padding-right: 30rpx;
			height: 120rpx;
			display: flex;
			align-items: center;
			border-bottom: 1px solid #ebecf4;
			.name{
				font-size: 32rpx;
				width: 200rpx;
			}
			input{
				flex: 1;
				height: 120rpx;
				font-size: 30rpx;
			}
			.text{
				flex: 1;
				margin-right: 20rpx;
			}
		}
		&_button{
			width: calc(100% - 60rpx);
			height: 100rpx;
			color: #fff;
			background: linear-gradient(120deg, #f31801, #e94f06);
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 36rpx;
			border-radius: 8px;
			margin-top: 50rpx;
		}
		&_box{
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			.bj{
				position: absolute;
				width: 100%;
				height: 100%;
				left: 0;
				top: 0;
				background: rgba(0,0,0,.2);
			}
			.box{
				position: absolute;
				left: 0;
				bottom: 0;
				width: 100%;
				height: 50%;
				background: #fff;
				.title{
					width: 100%;
					height: 100rpx;
					font-size: 36rpx;
					font-weight: bold;
					display: flex;
					align-items: center;
					justify-content: center;
					position: relative;
					border-bottom: 1px solid #ddd;
					.icon{
						position: absolute;
						right: 30rpx;
					}
				}
				.list{
					width: calc(100% - 60rpx);
					padding-left: 30rpx;
					padding-right: 30rpx;
					&_title{
						width:100%;
						padding-top: 30rpx;
						font-size: 32rpx;
						color: #999;
					}
					&_box{
						width: 100%;
						padding-top: 10rpx;
						display: flex;
						flex-wrap: wrap;
						.item{
							width: calc(33.33% - 20rpx);
							height: 60rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							border: 1px solid #ddd;
							margin-top: 20rpx;
							border-radius:6px;
							font-size: 28rpx;
							margin-left: 20rpx;
						}
						.item:nth-child(3n+1){
							margin-left: 0;
						}
						.item.is{
							background: #e94f06;
							color: #fff;
						}
					}
				}
			}
		}
	}
</style>